package org.aergia.vinny.gui.controller;

import java.sql.Connection;
import java.util.Collection;

import org.aergia.vinny.core.ApiResult;
import org.aergia.vinny.core.enums.DayOfWeek;
import org.aergia.vinny.database.pojo.Card;
import org.aergia.vinny.database.pojo.OperatingHours;
import org.aergia.vinny.database.pojo.Scan;
import org.aergia.vinny.database.pojo.Service;
import org.aergia.vinny.database.pojo.ServiceType;
import org.aergia.vinny.database.pojo.Skill;
import org.aergia.vinny.database.pojo.VinnyOption;
import org.aergia.vinny.database.pojo.VinnyRole;
import org.aergia.vinny.database.pojo.VinnyUser;
import org.aergia.vinny.database.pojo.Volunteer;
import org.aergia.vinny.database.pojo.VolunteerGroup;
import org.aergia.vinny.database.pojo.Workstation;
import org.aergia.vinny.gui.view.VinnyFrame;

public interface VinnyController {

	public abstract ApiResult<VolunteerGroup> addGroup(final String groupName, final VinnyUser user);

	/**
	 * @param cardNumber
	 */
	public abstract void cardScanned(final String cardNumber);

	public abstract ApiResult<VolunteerGroup> deleteGroup(final VolunteerGroup group, final VinnyUser user);

	public abstract ApiResult<ServiceType> deleteServiceType(final ServiceType serviceType, final VinnyUser user);

	public abstract ApiResult<Workstation> deleteWorkstation(final Workstation workstation, final VinnyUser user);

	public abstract ApiResult<Card> getCard(final String cardNumber);

	/**
	 * @return list of cards, it maybe empty
	 */
	public abstract Collection<? extends Card> getCards();

	public abstract Connection getDatabaseConnection();

	/**
	 * @param groupName
	 * @return the result of getting the group
	 */
	public abstract ApiResult<VolunteerGroup> getGroup(final String groupName);

	public abstract Collection<? extends VolunteerGroup> getGroups();

	public abstract OperatingHours getHours(final DayOfWeek day);

	/**
	 * @param option
	 * @param defaultValue
	 * @return the the option or the default value if not set
	 */
	public abstract String getOption(final String option, final String defaultValue);

	public abstract Collection<? extends VinnyOption> getOptions();

	public abstract VinnyRole getRole(final String permission);

	public abstract Collection<? extends Scan> getScans();

	public abstract Collection<? extends Service> getServices();

	/**
	 * @return a list of service types
	 */
	public abstract Collection<? extends ServiceType> getServiceTypes();

	/**
	 * @param skillName
	 * @return the skill
	 */
	public abstract ApiResult<Skill> getSkill(final String skillName);

	public abstract Collection<? extends VinnyUser> getUsers();

	public abstract Collection<VinnyUser> getUsers(final String inRole);

	public abstract Collection<? extends Volunteer> getVolunteers();

	public abstract Collection<? extends Workstation> getWorkstations();

	public abstract ApiResult<Card> isCardAvailable(final Volunteer volunteer, final String cardNumber);

	public abstract boolean isUserNameInUse(final String userName);

	public abstract boolean isVinnyCard(final String cardNumber);

	public abstract ApiResult<Card> saveCard(final Card card, final VinnyUser user);

	public abstract ApiResult<VolunteerGroup> saveGroup(final VolunteerGroup group, final VinnyUser user);

	public abstract ApiResult<OperatingHours> saveHours(final OperatingHours hours, final VinnyUser user);

	public abstract ApiResult<VinnyOption> saveOption(final VinnyOption option, final VinnyUser user);

	public abstract ApiResult<Scan> saveScan(final Scan scan, final VinnyUser user);

	public abstract ApiResult<Service> saveService(final Service service, final VinnyUser user);

	public abstract ApiResult<ServiceType> saveServiceType(final ServiceType serviceType, final VinnyUser user);

	public abstract ApiResult<VinnyUser> saveUser(final VinnyUser saveUser, final VinnyUser user);

	public abstract ApiResult<Volunteer> saveVolunteer(final Volunteer volunteer, final VinnyUser user);

	public abstract ApiResult<Workstation> saveWorkstation(final Workstation workstation, final VinnyUser user);

	/**
	 * @param vinnyFrame
	 */
	public abstract void setVinnyFrame(final VinnyFrame vinnyFrame);

	public abstract ApiResult<Card> switchCard(final Card oldCard, final Card newCard);

	public abstract ApiResult<VinnyUser> validateUser(final String userName, final String password);

}